package model.bo;

import java.util.List;

import model.bean.Professor;
import model.persistencia.dao.HibernateUtil;
import model.persistencia.dao.ProfessorDAO;

public class ProfessorBO {
	private ProfessorDAO professorDAO = new ProfessorDAO(Professor.class);

	public Professor consultar(Professor aluno) {
		try {
			aluno = professorDAO.load(new Long(1));
		} catch (Exception e) {
			HibernateUtil.getInstance().rollbackTransaction();
		}
		return aluno;
	}

	public List<Professor> listar(Object professor) {

		List<Professor> professores = null;

		HibernateUtil.getInstance().startTransaction();
		try {
			professores = professorDAO.listar(professor);
			HibernateUtil.getInstance().commitTransaction();
		} catch (Exception e) {
			e.printStackTrace();
			HibernateUtil.getInstance().rollbackTransaction();
		}

		return professores;

	}
}
